package com.kwm.Service.impl;

import com.kwm.Aop.Log;
import com.kwm.Mapper.DeptMapper;
import com.kwm.Service.DeptService;
import com.kwm.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;


@Service
public class DeptServiceimpl implements DeptService {
    @Autowired
    private DeptMapper mapper;

    @Log
    @Override
    public List<Dept> list() {
        return mapper.list();
    }

    @Override
    public void delete(Integer id) {
        mapper.delete(id);
    }

    @Override
    public void add(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        mapper.add(dept);
    }
    @Log
    @Override
    public Dept getById(Integer id) {
        return mapper.getById(id);
    }

    @Override
    public void update(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        mapper.update(dept);
    }
}
